package com.hoshiicloud.mallshop.controller.homepage;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.service.StoreHomePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 店铺首页
 * @author linjx on 2019/8/30
 */
@RestController
@Api(value = "店铺首页-店铺首页商品数据统计",tags = {"店铺首页-店铺首页商品数据统计"})
@RequestMapping("/home-page/store-home-page")
public class StoreHomePageController {

    @Autowired
    private StoreHomePageService storeHomePageService;

    @ApiOperation("获取店铺首页顶部信息")
    @GetMapping("/getHomePageTop")
    public Response getHomePageTop() {
        return Response.data(storeHomePageService.getHomePageTop(59L));
    }

    @ApiOperation("交易总览")
    @GetMapping("/transactionsView/{aheadDays}")
    public Response transactionsView(@PathVariable("aheadDays") Integer aheadDays) {
        return Response.data(storeHomePageService.transactionsView(aheadDays, 59L));
    }

    @ApiOperation("交易趋势")
    @GetMapping("/trendChart/{aheadDays}")
    public Response orderPayRate(@PathVariable("aheadDays") Integer aheadDays) {
        return Response.data(storeHomePageService.trendChart(aheadDays, 59L));
    }
}
